T = int(input())
h = []
w = []
SUM = 0
for i in range(T):
width,height = map(int,input().split())
SUM+= width
w.append(width)
h.append(height)
H_S = h.copy()
H_S.sort()
for i in range(T):
a = SUM-w[i]
b = H_S[T-1]
if h[i] == H_S[T-1]:
b = H_S[T-2]
print(a*b,end = " ")
967B - Watering System | 152A - Marks |
1398A - Bad Triangle | 137A - Postcards and photos |
1674D - A-B-C Sort | 334A - Candy Bags |
855A - Tom Riddle's Diary | 1417A - Copy-paste |
1038A - Equality | 1061A - Coins |
1676E - Eating Queries | 1447A - Add Candies |
1721D - Maximum AND | 363C - Fixing Typos |
1401A - Distance and Axis | 658A - Bear and Reverse Radewoosh |
1721E - Prefix Function Queries | 977E - Cyclic Components |
1140D - Minimum Triangulation | 75C - Modified GCD |
1722A - Spell Check | 1722B - Colourblindness |
1722D - Line | 1722C - Word Game |
1722G - Even-Odd XOR | 552E - Vanya and Brackets |
933A - A Twisty Movement | 1722F - L-shapes |
1196B - Odd Sum Segments | 1325D - Ehab the Xorcist |